package com.jc.ds.model;

/**
 * user_role
 * @author 
 */
public class UserRole extends BaseValueObject {
    private Long id;

    private Long userId;

    private Long roleId;

    private String orderStr = null;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Long getRoleId() {
        return roleId;
    }

    public void setRoleId(Long roleId) {
        this.roleId = roleId;
    }

    public void orderById(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by id asc";
            }else{
                this.orderStr = this.orderStr + ",id asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by id desc";
            }else{
                this.orderStr = this.orderStr + ",id desc";
            }
        }
    }

    public void orderByUserId(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by user_id asc";
            }else{
                this.orderStr = this.orderStr + ",user_id asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by user_id desc";
            }else{
                this.orderStr = this.orderStr + ",user_id desc";
            }
        }
    }

    public void orderByRoleId(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by role_id asc";
            }else{
                this.orderStr = this.orderStr + ",role_id asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by role_id desc";
            }else{
                this.orderStr = this.orderStr + ",role_id desc";
            }
        }
    }
}